<template>
	<view>
		<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback">
			<view class="item" v-for="(item, index) in payCostList" :key="index" @click="itemClick(item)">
				<view class="income_list">
					<view class="income-item">
						<view class="income-title">
							<text class="income-title-name">{{item.tradingChannel|tradingChannel}}</text>
							<text class="income-title-level">{{"￥"+item.applyAmount|filterNull}}</text>
						</view>

						<view class="income-title">
							<text class="income-time" style="flex-grow: 1;">{{item.applyTime|filterNull}}</text>
							<text class="income-time">{{item.wthdrawalState|wthdrawalState}}</text>
						</view>
					</view>
				</view>
			</view>
		</mescroll-body>
	</view>
</template>

<script>
	import {
		withdrawalRecord
	} from '@/api/marketing-api.js';

	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
	export default {
		mixins: [MescrollMixin], // 使用mixin
		data() {
			return {
				payCostList: []
			}
		},

		onLoad() {},
		methods: {
			upCallback(page) {
				withdrawalRecord({
					memberNo: this.$store.state.user.userInfo.memberNo,
					pageNo: page.num,
					pageSize: page.size
				}).then(res => {
					this.mescroll.endSuccess(res.data.length);
					//设置列表数据
					if (page.num == 1) this.payCostList = []; //如果是第一页需手动制空列表
					this.payCostList = this.payCostList.concat(res.data); //追加新数据
				}).catch(() => {
					//联网失败, 结束加载
					this.mescroll.endErr();
				})
			}
		},


	}
</script>

<style lang="scss" scoped>
	.income_list {
		@include flex;
		width: 100%;
		align-items: center;
		background-color: $bg-white-color;

		image {
			width: 60upx;
			height: 60upx;
			margin-left: 40upx;
		}

		.income-item {
			flex-grow: 1;
			margin: 40upx 40upx 20upx 20upx;
			@include flex(column);

			.income-title {
				@include flex;
				align-items: center;

				.income-title-name {
					font-size: 28upx;
					color: $text-color-33;
					flex-grow: 1;
				}

				.income-title-level {
					font-size: 24upx;
					color: $text-color-33;
					font-weight: bold;
				}

			}

			.income-time {
				font-size: 26upx;
				color: $text-color-66;
				margin-top: 10upx;
			}
		}

		.income-money {
			color: $main-color;
			font-weight: bold;
			font-size: 28upx;
			margin-right: 40upx;
		}

	}
</style>
